﻿using DDDNorthWind.Core.Test.Aggregate;
using DDDNorthWind.Core.Test.Entities;
using DDDNorthWind.Core.Test.ValueObject;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DDDNorthWind.Core.Test
{
    [TestClass]
    public class EntityTest
    {
        [TestMethod]
        public void CreateNewWithKey()
        {
            var peopleId = new PeopleId("DNI12345678");
            var root = new People(peopleId);


            Assert.IsTrue(root.Id.Equals(peopleId));

        }

       

        [TestMethod]
        public void CreateNewWithOutKey()
        {

            var root = new People();
            Assert.IsNotNull(root.Id);
            Assert.IsNotNull(root.Id.Id);

        }

        [TestMethod]
        public void SetPeopleToAggregate()
        {

            var peopleId = new PeopleId("DNI12345678");
            IPeopleAggregate aggregate = new People(peopleId);

            var people = aggregate
                .AssignPeopleValue("Daniel", "Mazzini")
                .AssignAddress("Barcelona", "08401", "Sant Esteve");
                


            Assert.AreEqual("Barcelona",people.Address.Province);
            Assert.AreEqual("Daniel", people.FirstName);
        }
    }
}
